﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Timers;
using System.ComponentModel;
using System.Data;
using System.Windows.Forms;

namespace UserInterface
{
    [Serializable()]
    public class TrafficLight
    {

        // name
        protected string name;
        // position
        protected Point pos;

        //protected float x;
        //protected float y;
        protected float width;
        protected float height;

        //Graphics g = default(Graphics);

       

        /// <summary>
        /// This to get the position of the traffic light to be drawn.
        /// It will give the point x and y.
        /// </summary>
        public Point position
        {
            get { return this.pos; }
            set { this.pos = value; }
        }

        public string Name
        {
            get { return this.name; }
        }
        
        //constructor
        /// <summary>
        /// The constructor of the traffic light.
        /// </summary>
        public TrafficLight(string nm, Point p, Color c)
        {
            this.name = nm;
            this.pos = p;
            this.color = c;
            this.width = 10;
            this.height = 10;
            intervalTobeGreen = 4000;
        }

        public Color color { get; set; }

        // Draw()
        /// <summary>
        /// This basically use paint to draw the traffic light.
        /// Use drawEllipse function to get round light.
        /// </summary>
        /// <param name="e"></param>
        public void Draw(PaintEventArgs e)
        {
            Pen p = new Pen(this.color);
            e.Graphics.DrawEllipse(p, pos.X, pos.Y, width, height );
        }

        public int intervalTobeGreen
        { get; set; }


    }
}
